Skip to content

[WSLC] Reject UNC paths in WSLC filesystem policy#537

Merged
SohamDas2021 merged 1 commit into
mainfrom
user/sodas/wslc-reject-unc-paths
Jun 18, 2026
Merged

[WSLC] Reject UNC paths in WSLC filesystem policy#537
SohamDas2021 merged 1 commit into
mainfrom
user/sodas/wslc-reject-unc-paths

Conversation

@SohamDas2021

@SohamDas2021 SohamDas2021 commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

📖 Description

The WSLC backend can only mount drive-letter paths (translated to /mnt/<drive>/); UNC paths (\\server\share, \\wsl$\..., \\?\...) have no mapping mechanism in the WSLC SDK. Previously these were silently skipped with a warning log, risking silent misconfiguration where users believe a path is mounted but it isn't.
This change makes build_volume_mounts() return a hard error for any path that isn't a valid drive-letter path, failing execution before the container starts with a clear message identifying the offending path.

🔗 References

🔍 Validation

✅ Checklist

📋 Issue Type

  • Bug fix
  • Feature
  • Task

GitHub Actions runs the PR validation build automatically. The ADO pipeline
(MXC-PR-Build) is the official build pipeline that signs the binaries; it
runs on merge to main and nightly, and Microsoft reviewers can trigger it
on a PR with /azp run. See docs/pull-requests.md.

Microsoft Reviewers: Open in CodeFlow

Copilot AI review requested due to automatic review settings June 18, 2026 17:34
@SohamDas2021 SohamDas2021 requested a review from a team as a code owner June 18, 2026 17:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the WSLC backend’s filesystem policy handling by failing fast when readwritePaths / readonlyPaths contain non-drive-letter Windows paths (e.g., UNC paths), avoiding silent “mount skipped” misconfiguration before the container starts.

Changes:

  • Changed policy_mapping::build_volume_mounts() to return Result and to hard-error on any non-drive-letter path.
  • Updated the WSLC runner to treat mount-building failures as execution errors (instead of logging warnings and continuing).
  • Updated unit tests to assert rejection behavior for UNC and other invalid paths.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/backends/wslc/common/src/wsl_container_runner.rs Converts mount-building failures into an early ScriptResponse::error before container creation.
src/backends/wslc/common/src/policy_mapping.rs Implements strict validation (drive-letter only) for volume mounts and updates unit tests accordingly.

Comment on lines 65 to 67
/// - `readwrite_paths` → mounts with `read_only: false`
/// - `readonly_paths` → mounts with `read_only: true`
/// - `denied_paths` → not mounted (Linux container isolation means they're inaccessible)
@SohamDas2021 SohamDas2021 force-pushed the user/sodas/wslc-reject-unc-paths branch from e5155a0 to a1b0e4a Compare June 18, 2026 18:00

@MGudgin MGudgin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@SohamDas2021 SohamDas2021 merged commit 02d0fcd into main Jun 18, 2026
18 checks passed
@SohamDas2021 SohamDas2021 deleted the user/sodas/wslc-reject-unc-paths branch June 18, 2026 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants